package com.xxx.blog.service;

import com.xxx.blog.dao.ReplyMapper;
import com.xxx.blog.po.Comment;
import com.xxx.blog.po.Reply;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.List;

@Service
public class ReplyServiceImpl implements ReplyService {
    @Resource
    private ReplyMapper replyMapper;

    @Transactional
    @Override
    public void saveComment(Reply reply) {
        replyMapper.saveComment(reply);
    }

    @Transactional
    @Override
    public Comment findLast() {
        Comment comment = replyMapper.findLast();
        return comment;
    }

    @Transactional
    @Override
    public List<Reply> findById(Long id) {
        return replyMapper.findById(id);
    }

    @Transactional
    @Override
    public void deleteById(Long id) {
        replyMapper.deleteById(id);
    }

}
